﻿using UnityEngine;
using System.Collections;
namespace net{
	public class picked : MonoBehaviour {
		public int value ;

		void OnTriggerEnter2D(Collider2D c){

			GameObject target = c.collider2D.gameObject;

			if(target.tag.StartsWith("TANK_PLAYER")&&target.networkView.isMine){
				 
				NetMain.assetCount += value;
print("start destroy myself");				//销毁自身
				Network.RemoveRPCs(this.networkView.viewID);
				Network.Destroy(gameObject);
			}
		}


		void OnNetworkInstantiate(NetworkMessageInfo info){
			if(!networkView.isMine){
				GetComponent<picked>().enabled = false;
			}

		}
	}
}